﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TruckWatch.Cloud.Models;
using TruckWatch.Cloud.DAL;

namespace TruckWatch.Cloud.BusinessLogic
{
    public static class SecurityBL
    {

        public static DriverNEF CheckDriverCredentials(DriverCredential credential)
        {
            //
            DriverNEF driver = DriverDAL.GetDriverByUserId(credential.UserId);

            if (driver == null || driver.PassHash != credential.PassHash)
                throw new AppException("PassHash not valid for UserId");

            return driver;
        }

    }


}
